" 设置行号
set number
" 打开高亮
syntax on

" set relativenumber

set cursorline
set wrap
set showcmd
set wildmenu

set hlsearch
exec "nohlsearch"
set incsearch
set ignorecase
set smartcase

noremap n nzz
noremap N Nzz

noremap J 5j
noremap K 5k

" 表示注释
" 可以粘贴复制
set mouse=r 
" colorscheme hybrid
" F2 切换粘贴模式
set pastetoggle=<F2>
" 搜索高亮
set hlsearch
" 在插入模式下，按两下jj进入normal模式
inoremap jj <Esc>
" use ctrl+h/j/k/l switch window
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l

map s <nop>
noremap S :w<cr>
noremap Q :q<cr>
noremap SS :w!<cr>
noremap QQ :q!<cr>
noremap RR :source ~/.vimrc<CR>


" install vim-plug
" sudo vim /etc/hosts
" 添加一行
" 185.199.111.133 raw.githubusercontent.com
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
" :source
" :PlugInstall


call plug#begin()
" The default plugin directory will be as follows:
"   - Vim (Linux/macOS): '~/.vim/plugged'
"   - Vim (Windows): '~/vimfiles/plugged'
"   - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged'
" You can specify a custom plugin directory by passing it as the argument
"   - e.g. `call plug#begin('~/.vim/plugged')`
"   - Avoid using standard Vim directory names like 'plugin'

" Make sure you use single quotes
Plug 'vim-airline/vim-airline'
Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug']}
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
call plug#end()
" You can revert the settings after the call like so:
"   filetype indent off   " Disable file-type-specific indentation
"   syntax off            " Disable syntax highlighting

" :source ~/.vimrc

" set to 1, nvim will open the preview window after entering the markdown buffer
" default: 0
let g:mkdp_auto_start = 0

" set to 1, the nvim will auto close current preview window when change
" from markdown buffer to another buffer
" default: 1
let g:mkdp_auto_close = 1

" set to 1, the vim will refresh markdown when save the buffer or
" leave from insert mode, default 0 is auto refresh markdown as you edit or
" move the cursor
" default: 0
let g:mkdp_refresh_slow = 0

let g:mkdp_browser = 'firefox'

" set default theme (dark or light)
" By default the theme is define according to the preferences of the system
let g:mkdp_theme = 'dark'

" example
nmap <F5> <Plug>MarkdownPreview
nmap <F6> <Plug>MarkdownPreviewStop
nmap <F7> <Plug>MarkdownPreviewToggle